{% extends "base.html" %}

{% block title %} {{ blog.caption }} - LBlog {% endblock %}
            
{% load comments %}
            
{% block content_body %}
 <article class="main_blog">
	<header class="entry-header">
		<h1 class="entry-title">{{ blog.caption }}</h1>
			<div class="entry-meta">
				<span class="li_small_1">分类：<a href="{{ blog.classification.get_absolute_url }}">{{ blog.classification }}</a></span>
                <span class="li_small_1">作者：<a href="{{ classification.get_absolute_url }}">{{ blog.author }}</a></span>
                <span class="li_small_1">发表时间：{{ blog.publish_time|date:"Y-m-d H:i" }}</span>
			</div>
	</header>
	<div class="entry-content clearfix">
		{{ blog.content|safe }}
	</div>
</article>
            
    <div class="comments">
      <a name="blog_comments" id="comments"></a>
      {% get_comment_count for blog as comment_count %}
      <div class="comments_nav">评论({{ comment_count }})</div>
      {% ifequal comment_count 0 %}
        <div class="comments_body">
          <div class="comment_container">没有评论
        </div>
      {% else %}
        {% get_comment_list for blog as comments %}
        <div class="comments_body">
            {% for comment in comments %}
            <div class="comment_container">
              <div class="comment_id"><a href="{{ comment.user_url }}"></a></div>
              <div class="cmt_user_info">
                <span class="li_small_2">{{ comment.user_name }}</span>
                <span class="li_small_2">{{ comment.submit_date|date:"Y-m-d H:i"}}</span>
                <span class="reply_comment" id="{{ comment.user_name }}"><a href="#newcomment">回复</a></span>
              </div>
              <div id="comment_content">{{ comment.comment }}</div>
            </div>
            {% endfor %}
      {% endifequal %}
      </div>
<hr>
<main class="col-md-12">
	<h2 class="page-title">新的评论</h2>
		<article class="post">
			<div class="entry-content clearfix">
					<div class="row">
    
      {% get_comment_form for blog as blog_form %}
      <div class="comments_body">
        <div class="comment_form">
          <form class="form-horizontal" action="{% comment_form_target %}" method="post" id="cmt_sub_form">
            {% csrf_token %}
            {{ blog_form.object_pk }}
            {{ blog_form.content_type }}
            {{ blog_form.timestamp }}
            {{ blog_form.site }}
            {{ blog_form.submit_date }}
            {{ blog_form.security_hash }}
            <div class="control-group">
         
              <div class="contact-form">
                <input type="text" id="id_name" class="col-md-6 col-md-offset-3"" name="name" placeholder="Name" value="{{ user.username }}"/>
              </div>
            </div>
            <div class="control-group">
              
              <div class="contact-form">
                <input class="col-md-6 col-md-offset-3"" id="id_email" type="email" name="email" placeholder="Email" value="{{ user.email }}"/>
              </div>
            </div>
            
            <a name="newcomment" id="newcomment"></a>
            <div class="control-group">
            
              <div class="contact-form">
                <textarea class="col-md-6 col-md-offset-3" rows="7" id="id_comment" name="comment" placeholder="comment"></textarea>
              </div>
            </div>
            <p style="display:none;"><label for="id_honeypot">如果你在该字段中输入任何内容，你的评论就会被视为垃圾评论。</label> <input type="text" name="honeypot" id="id_honeypot"></p>
            <div class="controls">
              <div class="form-actions">
                <input class="btn-send btn-5 btn-5b ion-ios-paperplane" id="submit_btn" type="submit" name="submit" value="submit"/>
                <input type="hidden" name="next" value="/detail/?id={{ blog.id }}"/>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
</div>
</div>
</div>
</article>
</main>
{% endblock %}



